//
//  NotifyingClass.m
//  TextApp
//
//  Created by panos on 16/11/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "NotifyingClass.h"

@implementation NotifyingClass

- (IBAction)displaySomeText:(id)sender
{
	NSString *firstObject = @"Milk";
	NSString *secondObject = @"Eggs";
	NSString *thirdObject = @"Butter";
	
	NSArray *shoppingListArray = [NSArray arrayWithObjects:
								  firstObject, secondObject, thirdObject, nil];
	
	
	NSString *typedValue = [textField stringValue];
	shoppingListArray = [shoppingListArray arrayByAddingObject:typedValue];
	
	
	NSString *stringToOutput = @"The Shopping list is: ";	
	stringToOutput = [stringToOutput stringByAppendingString:
					  [shoppingListArray componentsJoinedByString:@", "]];
	stringToOutput = [stringToOutput stringByAppendingString:@"\n"];
	[textView insertText:stringToOutput];
	
	
	stringToOutput = @"The first item in the list is: ";
	stringToOutput = [stringToOutput stringByAppendingString:
					  [shoppingListArray objectAtIndex:0]];
	stringToOutput = [stringToOutput stringByAppendingString:@"\n"];
	[textView insertText:stringToOutput];
	
	
	stringToOutput = [NSString stringWithFormat:
					  @"Index of the second object is %i\n", [shoppingListArray indexOfObject:
															  secondObject]];
	[textView insertText:stringToOutput];
	
	
	stringToOutput = [NSString stringWithFormat:
					  @"The shopping list contains %i elements\n\n", [shoppingListArray count]];
	[textView insertText:stringToOutput];
		
}


- (float)generateValue:(float *)originalValue
{
	float value = [textField floatValue];
	*originalValue = value;
	return [MathUtilities circumferenceFromRadius:value];
}

@end
